Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UtilityMethodTestCase: safeguard against duplicate test markers #642

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Dec 22, 2024

GetMethodParametersTest: sync with upstream

See PR PHPCSStandards/PHP_CodeSniffer#777

UtilityMethodTestCase: safeguard against duplicate test markers

Sister-PR to upstream PHPCSStandards/PHP_CodeSniffer#777 addressing issue PHPCSStandards/PHP_CodeSniffer#773.

This commit adds a testTestMarkersAreUnique() test method to the UtilityMethodTestCase class to automatically verify that the case file in use by the child test class only contains unique test markers.

The actual logic for the test is in a custom, static, assertion assertTestMarkersAreUnique() to allow for calling the assertion directly if an additional test case file is tokenized for the test.

Includes unit tests.
Includes updating a few tests related to the UtilityMethodTestCase itself to not run the testTestMarkersAreUnique() test when the test is testing an error condition/doesn't have a valid $phpcsFile property set.

See PR PHPCSStandards/PHP_CodeSniffer 777
Sister-PR to upstream PHPCSStandards/PHP_CodeSniffer 777 addressing issue PHPCSStandards/PHP_CodeSniffer 773.

This commit adds a `testTestMarkersAreUnique()` test method to the `UtilityMethodTestCase` class to automatically verify that the case file in use by the child test class only contains unique test markers.

The actual logic for the test is in a custom, `static`, assertion `assertTestMarkersAreUnique()` to allow for calling the assertion directly if an additional test case file is tokenized for the test.

Includes unit tests.
Includes updating a few tests related to the `UtilityMethodTestCase` itself to not run the `testTestMarkersAreUnique()` test when the test is testing an error condition/doesn't have a valid `$phpcsFile` property set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant